# from django.conf import settings
# from django.core.files.storage import Storage
# from fdfs_client.client import Fdfs_client, get_tracker_conf
#
#
# class FastDFSStorage(Storage):
#     def __init__(self, base_url=None, client_conf=None):
#         """
#             初始化对象
#             :param base_url:
#             :param client_conf:
#         """
#         if base_url is None:
#             base_url = settings.FDAS_URL
#         self.base_url = base_url
#
#         if client_conf is None:
#             client_conf = settings.FDFS_CLIENT_CONF
#         self.client_conf = client_conf
#
#     def _open(self, name, mode='rb'):
#     # 打开文件
#         pass
#
#     def _save(self, content):
#         # 保存文件
#         client = Fdfs_client(get_tracker_conf(settings.FDFS_CLIENT_CONF))
#         ret = client.upload_by_buffer(content.read())
#         if ret.get("Status") != "Upload successed.":
#             raise Exception("upload file failed")
#         file_name = ret.get("Remote file_id")
#         # byte转str
#         file_name = str(file_name, encoding="utf-8")
#         return file_name
#
#     def exists(self, name):
#         return False
#
#     def url(self, name):
#         return self.base_url + name

from django.conf import settings
from django.core.files.storage import Storage


class FastDFSStorage(Storage):
    def _open(self, name, mode='rb'):
        pass

    def _save(self, name, content):
        pass

    def exists(self, name):
        # 判断图片是否存在
        return False

    def url(self, name):
        return settings.FDFS_URL + name